extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "伊修"                   # 角色的名称
	attCoe.atkRan = 2                 # 攻击距离
	attCoe.maxHp = 5                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 7.5                    # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 3                 # 魔法攻击（每点代表13.7）
	attCoe.def = 4                    # 物理防御（每点代表15）
	attCoe.mgiDef = 4.5                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dao" 
	xb = "光"
	lv = 3   
	addSkillTxt("[修罗流火]<先发>喷出流火燃烧最近的敌方单体，造成100%光系物理伤害，30%概率令目标<灼烧>5秒[CD:6]")
	addSkillTxt("[上古战魂]上古的战魂力量觉醒，提升自身物攻，闪避和攻速各10%，最高60%[CD:15]")
	addSkillTxt("[六芒飞羽]扇动翅膀攻击敌方单体6次，每次造成20%光系物理伤害，每次恢复自身3%最大体力值[CD:12]")
	addCdSkill("xllh",6)
	addCdSkill("sgzh",15)
	addCdSkill("lmfy",12)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "xllh":
		xllh1()
	if id == "sgzh":
		var buff1 = hasBuff("wugong1")
		var buff2 = hasBuff("shanbi1")
		var buff3 = hasBuff("gongsu1")
		if buff1 == null:
			addBuff(bf.wugong1.new())
		elif buff1.att.atkL < 0.6:
			buff1.att.atkL += 0.1
		if buff2 == null:
			addBuff(bf.shanbi1.new())
		elif buff2.att.dod < 0.6:
			buff2.att.dod += 0.1
		if buff3 == null:
			addBuff(bf.gongsu1.new())
		elif buff3.att.spd < 0.6:
			buff3.att.spd += 0.1
	if id == "lmfy":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("六芒飞羽", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		for i in range(6):
			typeHurtCha(aiCha,att.atk*0.2,Chara.HurtType.PHY,Chara.AtkType.SKILL)
			plusHp(att.maxHp*0.03)

func xllh1():
	var chas = getAllChas(1)
	chas.sort_custom(self,"sort")
	lh(chas[0])

func lh(cha):
	var d:Eff = newEff("sk_feiZhan",sprcPos)
	d._initFlyCha(cha)
	yield(d,"onReach")
	typeHurtCha(cha,att.atk*1,Chara.HurtType.PHY,Chara.AtkType.SKILL)
	if sys.rndPer(30):
		cha.addBuff(bf.zhuoshao.new(5))

func sort(a,b):
	return cellRan(a.cell,cell) < cellRan(b.cell,cell)
